home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / June 96 / RE>How to embed a part into you < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  1.7 KB  |  [TEXT/ttxt]

  1. Subject:     RE>How to embed a part into yourself
  2. Sent:        6/14/96 5:37 AM
  3. Received:    6/14/96 9:17 AM
  4. From:        Rob Cope, rob@eclipse.cpcn.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8.  
  9.                                                                  Date: 6/13/96
  10. Subject:  RE>How to embed a part into yourself                  Time:  8:52 PM
  11. >Can someone point me to sample code or a routine that shows how to create a
  12. >part at run-time and embed in another part. For example, in response to the
  13. >user choosing the text tool from a palette and dragging a rectangle, create
  14. >a text part and embed it at the location the user specified.
  15.  
  16. Sorry I haven't tested this yet in R1, but I was planning on creating an embedded text part something like this 
  17. (which is pretty much what the D11 Insert menu item did):
  18. ...
  19.         ODPart* odEmbeddedPart;
  20.         ODStorageUnit* su = fPart->GetStorageUnit(ev);
  21.         
  22.         // ----- Create part that edits type 'TEXT' using whatever editor user has set in Editor Setup -----
  23.   ODValueType textKind = GetSession(ev)->GetTranslation(ev)->GetISOTypeFromPlatformType(ev, kTEXTOSType, kODPlatformDataType);
  24.         odEmbeddedPart = su->GetDraft(ev)->CreatePart(ev, textKind, NULL);
  25.         FW_ASSERT(odEmbeddedPart);
  26.         odEmbeddedPart->Externalize(ev);
  27.         
  28.         // ----- Create the default frame shape -----
  29.         FW_CAcquiredODShape frameShape = ::FW_NewODShape(ev, FW_CRect(FW_kZeroPoint, fNewPartSize));
  30.  
  31.         // ----- Embed the part -----
  32.      fSelectionContent->SingleEmbeddedFrameInternalized(ev,    fFrame, odEmbeddedPart, 
  33.                                                             NULL, 
  34.                                                             frameShape, fViewType);
  35.  
  36.         odEmbeddedPart->Release(ev);
  37. ...
  38.  
  39. Does this seem like the right approach?
  40.  
  41. Rob Cope
  42. Eclipse Services
  43.  
  44.